<template>
  <div class="template">
     <div class="Drawer-content" v-for="(item,index) in apiData.orderList" :key="index">
            <!-- <div class="status">
              {{item.statusName}}
            </div> -->
             <div class="Drawer-content-list">
              <div class="content-item-title">
                打单号：
              </div>
               <div class="content-item-center">
                {{item.id}}
              </div>
            </div>
            <div class="Drawer-content-list" v-if="apiData.column.info==1">
              <div class="content-item-title">
                收货信息：
              </div>
               <div class="content-item-center">
                <p>{{item.name}} {{item.phone}}</p>
                <p>{{item.address}}</p>
              </div>
            </div>
             <div class="Drawer-content-list"  v-if="apiData.column.remark==1">
              <div class="content-item-title">
                买家备注：
              </div>
               <div class="content-item-center">
                {{item.buyerRemark||'无'}}
              </div>
            </div>
            <Divider dashed />
            <div class="Drawer-content-list" v-if="apiData.column.orderNo==1">
              <div class="content-item-title">
                订单号：
              </div>
               <div class="content-item-center">
                {{item.orderNo||'无'}}
              </div>
            </div>
            <div class="Drawer-content-list" v-if="apiData.column.details==1">
              <div class="content-item-title">
                购买商品：
              </div>
               <div class="content-item-center">
                    <div class="content-item-center-box" v-for="(item,index) in item.details" :key="index">
                        <div>
                        <div class="content-item-center-box-title">
                            {{item.title}}<span v-if="item.type==2">[试样]</span>
                        </div>
                        <div class="content-item-center-box-content"  v-if="item.batchNum">
                            批号：{{item.batchNum}}
                        </div>
                        <div class="content-item-center-box-content" v-if="item.code">
                            编号：{{item.code}}
                        </div>
                        <div class="content-item-center-box-content"  v-if="item.skuName">
                            规格：{{item.skuName}}
                        </div>
                        <div class="content-item-center-box-content" v-if="item.typeName">
                            类型：{{item.typeName}}
                        </div>
                      </div>
                      <div>X{{item.num}}</div>
                    </div>
                    <p>共{{item.details.length}}件商品</p>
              </div>
            </div>
            <div class="Drawer-content-list" v-if="apiData.column.price==1">
              <div class="content-item-title">
                商品金额：
              </div>
               <div class="content-item-center">
                {{item.price||'0'}}
              </div>
            </div>
            <div class="Drawer-content-list" v-if="apiData.column.deliveryFee==1">
              <div class="content-item-title">
                运费：
              </div>
               <div class="content-item-center">
                {{item.deliveryFee||'包邮'}}
              </div>
            </div>
            <div class="Drawer-content-list" v-if="apiData.column.relAmount==1">
              <div class="content-item-title">
                实付金额：
              </div>
               <div class="content-item-center">
                {{item.relAmount||'0'}}
              </div>
            </div>
            <Divider dashed />
            <div class="Drawer-content-list" v-if="apiData.column.createTime==1">
              <div class="content-item-title">
                下单时间：
              </div>
               <div class="content-item-center">
                {{item.createTime||'--'}}
              </div>
            </div>
            <div class="Drawer-content-list"  v-if="item.payTime&&apiData.column.payTime==1">
              <div class="content-item-title">
                支付时间：
              </div>
               <div class="content-item-center">
                {{item.payTime||'--'}}
              </div>
            </div>
              <Divider dashed />
        </div>
  </div>
</template>

<script>
import {apiOrderinfoInfoList,apiPrintOrderConf} from '@/api/order-records.js'
export default {
  name: 'order-records',
  data () {
    return {
      query:{},
      search: {},
      diyDom:{},
      diyData: {},
      apiData: {
        orderList:'',
        column:'',
      }
    }      
  },
  methods: {
  
  getOrderInfo(){
    apiOrderinfoInfoList({...this.query}).then(res=>{
      this.apiData.orderList=res.data
    })
  },
  getPrintOrderConf(){
    apiPrintOrderConf().then(res=>{
      var data={}
        res.data.forEach(element => {
          data[element.column]=element.status
        });
        this.apiData.column=data
        console.log(data)
    })
  }
  },
   mounted () {
    this.query=this.$route.query
    this.getOrderInfo()
    this.getPrintOrderConf()
  },
}
</script>

<style scoped lang="less">
.template{
  width: 100%;
  background: #fff;
  padding: 20px;
  max-height: 100vh;
  box-sizing: border-box;
  overflow-y: auto;
}
.button-border{
  margin-right: 10px;
  
}
.Drawer-content{
  width: 100%;
  .status{
    font-size: 24px;
      font-weight: 400;
      letter-spacing: 0px;
      line-height: 34.75px;
      color: rgba(212, 48, 48, 1);
      text-align: left;
      margin-bottom: 15px;
  }
  .Drawer-content-list{
    width: 100%;
    margin-bottom: 15px;
    display: flex;
    .content-item-title{
      width: 80px;
      font-size: 12px;
      font-weight: 400;
      letter-spacing: 0px;
      line-height: 17.38px;
      color: rgba(56, 56, 56, 1);
      text-align: left;
    }
    .content-item-center{
      width: 365px;
      font-size: 12px;
      font-weight: 400;
      letter-spacing: 0px;
      color: rgba(56, 56, 56, 1);
      text-align: left;
      p{
        font-size: 12px;
        font-weight: 700;
        letter-spacing: 0px;
        color: rgba(56, 56, 56, 1);
        text-align: left;
      }
      p.name{
        font-size: 14px;
        font-weight: 700;
        letter-spacing: 0px;
        line-height: 20.27px;
        color: rgba(0, 0, 0, 1);
      }
      .content-item-center-box{
        width:100%;
        padding: 0px 0 10px;
        box-sizing: border-box;
        border-bottom: 1px solid #E5E5E5;
        margin-bottom: 10px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        .content-item-center-box-title{
          font-size: 14px;
          font-weight: 700;
          letter-spacing: 0px;
          line-height: 20.27px;
          color: rgba(0, 0, 0, 1);
          margin-bottom: 5px;
        }
        .content-item-center-box-content{
            font-size: 12px;
            font-weight: 400;
            letter-spacing: 0px;
            line-height: 17.38px;
            color: rgba(128, 128, 128, 1);
             margin-bottom: 3px;
        }
      }
    }
  }
}

.deliveryList-center{
  width: 100%;
  padding:0px 10px 20px; 
  box-sizing: border-box;
  border-left: 1px solid #FD7247;
  position: relative;
  
}
.updateTime{
  font-size: 12px;
  color: #666;
  margin-bottom: 5px;
}
.deliveryInfo{
  font-size:14px;
  color: #333;
}
.dian{
  position: absolute;
  top: -4px;
  left: -4px;
  width: 6px;
  height: 6px;
  background: #FD7247;
  border-radius: 50%;
  display: block;
}
</style>
